<template>
	<form action="">
		<h3 class="text-muted my-5">添加新的Pizza</h3>
		<div class="form-group row">
			<label for="" class="col-sm-1">品种</label>
			<div class="col-sm-11">
				<input type="text" class="form-control" v-model="newPizza.name">
			</div>
		</div>
		<div class="form-group row">
			<label for="" class="col-sm-1">描述</label>
			<div class="col-sm-11">
				<textarea class="form-control" rows="5" v-model="newPizza.description"></textarea>
			</div>
		</div>
		<p><strong>选项1</strong></p>
		<div class="form-group row">
			<label for="" class="col-sm-1">尺寸</label>
			<div class="col-sm-11">
				<input type="text" class="form-control" v-model="newPizza.size">
			</div>
		</div>
		<div class="form-group row">
			<label for="" class="col-sm-1">价格</label>
			<div class="col-sm-11">
				<input type="text" class="form-control" v-model="newPizza.price">
			</div>
		</div>

		<div class="form-group row">
			<button class="btn-success btn-block btn" type="button" @click="addMenu">添加</button>
		</div>
	</form>
</template>

<script>
	import axios from 'axios'
	export default{
		data(){
			return{
				newPizza:{
					name:"",
					description:"",
					size:"",
					price:0
				}
			}
		},
		methods:{
			addMenu(){
				// console.log(this.newPizza)
				let data={
					name:this.newPizza.name,
					description:this.newPizza.description,
					size:this.newPizza.size,
					price1:this.newPizza.price1
				}
				// fetch("/mock/admain/admain.json").then(res=>{
				// 	res.json()
				// }).then(data=>console.log(data))
				axios.get('/mock/admain/admain.json').then(res=>{
					console.log(res)
					this.$router.push('/menu')
				})
			}
		}
	}
</script>

<style>
</style>
